package com.zoagroup.funzy.entity;

import java.io.Serializable;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.zoagroup.funzy.entity.pk.StageResultPK;


/**
 * The persistent class for the stage_result database table.
 * 
 */
@Entity
@Table(name="stage_result")
public class StageResult implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private StageResultPK id;

	private Boolean result;

	//bi-directional many-to-one association to Stage
	@ManyToOne
	@JoinColumn(name="id_stage",insertable=false, updatable=false)
	private Stage stage;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="id_user",insertable=false, updatable=false)
	private User user;

	public StageResult() {
	}

	public StageResultPK getId() {
		return this.id;
	}

	public void setId(StageResultPK id) {
		this.id = id;
	}

	public Boolean getResult() {
		return this.result;
	}

	public void setResult(Boolean result) {
		this.result = result;
	}

	public Stage getStage() {
		return this.stage;
	}

	public void setStage(Stage stage) {
		this.stage = stage;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StageResult other = (StageResult) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
}